/*
 * NetworkClient.java
 * 2007-12-5 ����12:56:49
 * Author: Lex
 * Note: 
 */
package org.lex.net;

import java.io.IOException;
import java.net.InetAddress;

public abstract class NetworkClient {
	protected int soTimeout = 0;

	public NetworkClient() {
		super();
	}

	public abstract void openServer(String host, int port) throws IOException;

	public abstract void openServer(InetAddress host, int port) throws IOException;

	public abstract void closeServer() throws IOException;

	public abstract boolean isServerOpen();

	public int getSoTimeout() {
		return this.soTimeout;
	}

	public abstract void setSoTimeout(int timeout);

	public abstract InetAddress getClientAddress();

	public abstract int getClientPort();

	public abstract InetAddress getServerAddress();

	public abstract int getServerPort();

	protected void finalize() throws IOException {
		if (isServerOpen())
			closeServer();
	}
}
